package net.aiion.weave.impl.bytecode.events;

import net.aiion.weave.asm.Label;
import net.aiion.weave.spi.bytecode.BytecodeVisitor;
import net.aiion.weave.spi.bytecode.events.LocalVariableBytecodeEvent;

public class LocalVariableBytecodeEventImpl extends BytecodeEventImpl implements LocalVariableBytecodeEvent
{
    private String name;
    private String descriptor;
    private String signature;
    private Label startScopeLabel;
    private Label endScopeLabel;
    private int localVariableIndex;

    public LocalVariableBytecodeEventImpl(final String aName, final String aDescriptor, final String aSignature,
        final Label aStartScopeLabel, final Label aEndScopeLabel, final int aLocalVariableIndex)
    {
        name = aName;
        descriptor = aDescriptor;
        signature = aSignature;
        startScopeLabel = aStartScopeLabel;
        endScopeLabel = aEndScopeLabel;
        localVariableIndex = aLocalVariableIndex;
    }

    @Override
    public int getType() {
        return LOCAL_VARIABLE;
    }

    @Override
    public void setName(final String aName) {
        name = aName;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setDescriptor(final String aDescriptor) {
        descriptor = aDescriptor;
    }

    @Override
    public String getDescriptor() {
        return descriptor;
    }

    @Override
    public void setSignature(final String aSignature) {
        signature = aSignature;
    }

    @Override
    public String getSignature() {
        return signature;
    }

    @Override
    public void setStartScopeLabel(final Label aStartScopeLabel) {
        startScopeLabel = aStartScopeLabel;
    }

    @Override
    public Label getStartScopeLabel() {
        return startScopeLabel;
    }

    @Override
    public void setEndScopeLabel(final Label aEndScopeLabel) {
        endScopeLabel = aEndScopeLabel;
    }

    @Override
    public Label getEndScopeLabel() {
        return endScopeLabel;
    }

    @Override
    public void setLocalVariableIndex(final int aLocalVariableIndex) {
        localVariableIndex = aLocalVariableIndex;
    }

    @Override
    public int getLocalVariableIndex() {
        return localVariableIndex;
    }

    @Override
    public BytecodeVisitor acceptBytecodeVisitor(final BytecodeVisitor aBytecodeVisitor) {
        aBytecodeVisitor.asBytecodeMethodVisitor().visitLocalVariable(this);
        return aBytecodeVisitor;
    }
}
